擅长:python、mysql、java
<p>给你</p>
<pre><code>x, y, z = rand_sphere(200)
m = 10
# creating lists and storing them in res
# each list contains the elements of a line
res = [ [m, x[i], y[i], z[i]] for i in range(len(x)) ]
data = "This line will be text"
# concatenating line elements
for elem in res:
data = "{}\n{}".format( data, ','.join(str(num) for num in elem) )
with open(my_file, 'w') as file:
file.write(data)
</code></pre>