Let’s say you have a Python script that prompts the user for their name and then writes “Hi, {Name}”
Now in PowerShell this is super easy, I can create a custom function, throw it into my PowerShell $Profile, and set an alias (and call it something like Get-Name). Then, in VSCode I can simply type “Get-Name” without having to search for the program, open it, fiddle with it, etc. Meaning I can have any file open in VSCode and type Get-Name and it always works. As you can imagine, this is super fast and convenient.
How do I do the same thing with Python? Suppose the file is in c:/code/name.py, what would you do? Again the goal is so I don’t have to constantly navigate through the folders, find the file, open it, click run, and then use it.
submitted by /u/grep212
[link] [comments]
r/learnpython Let’s say you have a Python script that prompts the user for their name and then writes “Hi, {Name}” Now in PowerShell this is super easy, I can create a custom function, throw it into my PowerShell $Profile, and set an alias (and call it something like Get-Name). Then, in VSCode I can simply type “Get-Name” without having to search for the program, open it, fiddle with it, etc. Meaning I can have any file open in VSCode and type Get-Name and it always works. As you can imagine, this is super fast and convenient. How do I do the same thing with Python? Suppose the file is in c:/code/name.py, what would you do? Again the goal is so I don’t have to constantly navigate through the folders, find the file, open it, click run, and then use it. submitted by /u/grep212 [link] [comments]
Let’s say you have a Python script that prompts the user for their name and then writes “Hi, {Name}”
Now in PowerShell this is super easy, I can create a custom function, throw it into my PowerShell $Profile, and set an alias (and call it something like Get-Name). Then, in VSCode I can simply type “Get-Name” without having to search for the program, open it, fiddle with it, etc. Meaning I can have any file open in VSCode and type Get-Name and it always works. As you can imagine, this is super fast and convenient.
How do I do the same thing with Python? Suppose the file is in c:/code/name.py, what would you do? Again the goal is so I don’t have to constantly navigate through the folders, find the file, open it, click run, and then use it.
submitted by /u/grep212
[link] [comments]