Created
July 16, 2023 09:45
-
-
Save exemplum100/5216401c07f8809917dc1408816bac6f to your computer and use it in GitHub Desktop.
Quote data to sql something
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# simple quote val | |
# exmpl: '1000000000','2222222','333333333' | |
x='''10000000000000000000 | |
222222222222222222222 | |
3333333333333333333 | |
4444444444444444444444 | |
55555555555555555555555 | |
''' | |
def formz(x): | |
y=x.rstrip().replace('\n','\',\'') # '\n','\',\'' '\n',',' | |
y='\''+y+'\'' | |
return y | |
with open('SQLquote.txt', 'wt') as xfile: | |
xfile.write(formz(x)) | |
xfile.close() | |
print('SQLquote.txt ready') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment