import uuid
our_input_file = open('input', 'r', encoding='utf-8')
our_output_file = open('out', 'w', encoding='utf-8')
readlines = our_input_file.readlines()
read = our_input_file.read()
headers = []
body = []
def parse_it():
first_row = readlines[0]
print(readlines)
print(first_row)
body_readlines = readlines.remove(first_row)
for x in body_readlines:
if x:
body.append(x)
def write_out():
for x in readlines:
if len(x.split('descriptionGuid')) > 1:
x = '"descriptionGuid": "%s",' % uuid.uuid4()
our_output_file.writelines(x)
def main():
for x in range(int(input('how much do you need ? : '))):
write_out()
parse_it()
main()
при выполнении возвращает :
Traceback (most recent call last):
File "/Users/ivanburdin/Desktop/PycharmProjects/making_ammo/make_ammo_uri_post.py", line 31, in
main()
File "/Users/ivanburdin/Desktop/PycharmProjects/making_ammo/make_ammo_uri_post.py", line 29, in main
parse_it()
File "/Users/ivanburdin/Desktop/PycharmProjects/making_ammo/make_ammo_uri_post.py", line 16, in parse_it
for x in body_readlines:
TypeError: 'NoneType' object is not iterable
Process finished with exit code 1
Собсна, он не может присвоить значение переменной "body_readlines", видимо, я где то напутал в областью видимости переменных..., подскажите, в чем дело?