read text two lines into dict

(py36-venv) [zhuby1973@HansVM ~]$ cat convert.py

my_dict = {}

with open('./out.txt', 'r') as file_object:

for values in file_object:

values = values.split()

key = next(file_object, None)

if key is None:

# oops, we got to the end of the file early

raise ValueError('Invalid file format, missing key')

my_dict[key.strip()] = values

for key,value in my_dict.items():

print("bbbb.saveShare('{}', '{}', path='/')".format(value,key))


(py36-venv) [zhuby1973@HansVM ~]$ python convert.py

bbbb.saveShare('['https://pan.baidu.com/s/1S6ydPiR0cRMqgCHl-tIoFg']', 't6gt', path='/')

bbbb.saveShare('['https://pan.baidu.com/s/1ko26iIOcPt_HS9RmLqjbSw']', '7128', path='/')

bbbb.saveShare('['https://pan.baidu.com/s/1fCQ0NMG107sMh3DklnUYEA']', '5l69', path='/')

bbbb.saveShare('['https://pan.baidu.com/s/1pskTd9y4Mu8qOZr6Loor7g']', '56x2', path='/')

bbbb.saveShare('['https://pan.baidu.com/s/1LZjj3bCq4D7LrM34A1P0XQ']', 'zfea', path='/')

bbbb.saveShare('['https://pan.baidu.com/s/1Zii0NZ9n6fu8roSgn_D9AQ']', '1773', path='/')

..................................