擅长:python、mysql、java
<p>这就是我如何可视化你的数据文件</p>
<pre><code>x1,y1,z1
x2,y2,z2
x3,y3,z3
.
.
.
</code></pre>
<p>我有点搞不懂你是怎么描述你的数据文件的。是用空格分隔的吗?如果是这样,你可以像这样读入数据。你知道吗</p>
<pre><code>with open('input.csv') as csv_file:
csv_reader = csv.reader(csv_file, delimiter=' ')
</code></pre>
<p>如果它实际上是由分隔的,那么就这样做。你知道吗</p>
<pre><code>with open('employee_birthday.txt') as csv_file:
csv_reader = csv.reader(csv_file, delimiter=',')
</code></pre>
<p>你能做的就是循环通过,然后像这样从每一行拉出xy和z。你知道吗</p>
<pre><code>import csv
with open('new.csv', mode='w') as out_file:
csv_writer = csv.writer(out_file, delimiter=',')
#initialize new csv file.
for x, y, z in input_file:
#I assume you want to read them as string to add the -
x = str(x)
y = str(y)
z = str(z)
# add the -
z = "-" + z
csv_writer.writerow([x, y, z])
</code></pre>