Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # to use you gotta convert the .rng files to .txt files first, you can do this by opening command prompt, picking the folder with the ranges you wanna convert by putting in "cd filepath"
- # pressing enter and then "ren *.rng *.txt". Once the files are all .txt you gotta put them in the same folder as the script, change path file and openraisers position and thats it (I hope)
- # Step by step tutorial in video format: https://youtu.be/zsxkj1RBktw if you run into other problems add me on discord 'hampii#6954'
- import glob
- import os
- f = glob.glob("*.txt")
- for x in range(len(f)):
- file_name = f[0]
- periods = file_name.count(".")
- #change for your filepath obv
- next_path = "C:\\Users\\Rene\\PycharmProjects\\draft\\pioranges\\"
- sizes = file_name.split(".")
- postions = ["LJ", "HJ", "CO", "BU", "SB", "BB"]
- #change who's first in
- first_pos = "BU"
- abc = postions.index(first_pos)
- open_raiser = postions[abc:]
- for i in range(len(sizes)-1):
- if sizes[0] == "0":
- next_path += open_raiser[0] + "f" + "\\"
- open_raiser.pop(0)
- sizes.pop(0)
- elif sizes[0] == "1":
- next_path += open_raiser[0] + "c" + "\\"
- sizes.pop(0)
- open_raiser.append(open_raiser[0])
- open_raiser.pop(0)
- elif sizes[0] == "3":
- next_path += open_raiser[0] + "j" + "\\"
- open_raiser.pop(0)
- sizes.pop(0)
- elif sizes[0] == "5":
- next_path += open_raiser[0] + "min" + "\\"
- open_raiser.append(open_raiser[0])
- open_raiser.pop(0)
- sizes.pop(0)
- else:
- next_path += open_raiser[0] + "r" + sizes[0][2:] + "\\"
- open_raiser.append(open_raiser[0])
- open_raiser.pop(0)
- sizes.pop(0)
- if not os.path.exists(next_path):
- os.makedirs(next_path)
- lines = [line.rstrip('\n') for line in open(file_name)]
- string = ""
- while len(lines) > 0:
- hand = lines.pop(0) + ":"
- value = lines.pop(0).split(";", maxsplit=1)[0] + ","
- string += hand + value
- next_path += file_name
- print(next_path)
- new_file = open(next_path, "w+")
- new_file.write(string)
- new_file.close()
- f.pop(0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement