I have started using GitHub to display some extremely simple programs. https://github.com/MasonMcGerry
I want to upload more simple programs but many of them have the full and absolute filepaths to directories and files I am using in the programs.
I don't want to put that out on the internet because that seems unsecure, but perhaps this doesn't matter.
I was thinking of making a new clone of the projects and then changing the paths to something made-up like /path/to/this/file. It seems like this would take much longer and I'd have issues with debugging because I'd be programming on my localhost with the absolute filepaths, testing them out, then rewriting the filepaths for the "GitHub ready/safe" version.
The working version on my localhost and the "clone" would both be on my computer but only the "clone" would have .git file in it's directory.
Example of simple program below with changed filepath.
# for converting tag types to another platforms design
# filepath
fp = '/Users/username/Desktop/Projects/Programs/tagConverter/'
IG = ['IG','ig','instagram','Instagram']
YT = ['YT','yt','youtube','Youtube','Youtube']
end = ['end','END','End','stop','STOP','Stop']
runState = True
# Instagram
def convIG():
# takes convTxt.txt file, strips out commas and puts each item into array
# line by line writes into convIG.txt
# open up file /Users/username/Downloads/tagConverter/convTxt.txt
# and read it
f = open(fp + 'convTxt.txt','r')
inconvIG = f.read()
outconvIG = '#'+("#").join(inconvIG[0:].split(','))
g = open(fp + 'convIG.txt','w')
g.write(outconvIG.replace(' ',''))
g.close()
f.close()
# YouTube
"""
will need ML to separate recognizable words with spaces like NLP
other Instagram tags like '#Howto#DIY' will become CSV howto,diy
instead of the preferred 'How to, DIY'
probably will use 'in' operator to help recognize and separate words
i.e.
s = '#howto'
x = ''
if 'how' in s:
x += 'how '
if 'to' in s:
x += 'to '
print(x)
x == 'how to '
"""
def convYT():
# takes convTxt.txt file, strips out # and puts each item into array
# line by line writes into convYT.txt
# open up file /Users/username/Downloads/tagConverter/convTxt.txt
# and read it
f = open(fp + 'convTxt.txt','r')
inconvYT = f.read()
outconvYT = (",").join(inconvYT[0:].split('#'))
g = open(fp + 'convYT.txt','w')
g.write(outconvYT)
g.close()
f.close()
def prompt():
global runState
prompt = input("Which Tag Type would you like to convert to?\n")
if prompt in IG:
convIG()
elif prompt in YT:
convYT()
elif prompt in end:
runState = False
else:
print('fail')
# indefinite loop, enter an end word listed in 'end' list
while runState == True:
prompt()
"""
SOURCES:
https://stackoverflow.com/questions/2783969/compare-string-with-all-values-in-array
https://stackoverflow.com/questions/18132912/checking-if-a-value-is-equal-to-any-value-in-an-array
https://stackoverflow.com/questions/29101836/typeerror-function-object-is-not-subscriptable-python
Reuben Young colleague and friend
https://www.journaldev.com/23763/python-remove-spaces-from-string
https://www.programiz.com/python-programming/global-keyword
https://help.instagram.com/351460621611097
https://www.w3schools.com/python/gloss_python_global_variables.asp
https://beginnersbook.com/2019/03/python-any-function/
https://www.programiz.com/python-programming/list-comprehension
"""
I realize that this code is quite simple but some of them will be more complex as I progress and that will be a nuisance.
Is there a work around and am I being paranoid or misunderstand/misusing this tech(git/github)?