How do I ask the user to open a file from their computer?
I'm making a program that requires the user to upload a file from their computer. I know I can use something like
Documents/text.txt to open a specific file but I want the user to choose which file they open from their computer. How do I do this in Python?
If it is
HTML Then you could do something like this:
<form action="the_script_below.php" method="post"> <input type="file" value="Upload A File" name="file" required> <br><br> <input type="submit"> </form>
<?php $file = $_POST['file']; #Do Something With The File Such As Making A Copy ?>
Hope this helps and if it doesn't please specify a language!
I don't know about their file, but may this:
userinput = input('file : ') f = open(userinput, 'r'): print(f.read())