Attach a file to a code | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Attach a file to a code

Dear all, is it possible to add a txt file to some code? Because my code won’t work without such a file. It should be the same directory, to keep it simple. Thank you and have a great night.

11th Sep 2018, 9:07 PM
Marc Maurer
Marc Maurer - avatar
2 Answers
+ 2
Hi Marc Maurer, You did not assign any language to your question. Do you need to work with the file like delete, insert, remove, etc.. etc..? Hope this helps👍 In PHP to echo out the textfile.txt:: <?php echo file_get_contents("YOUR_TEXT_FILE.txt"); ?> https://secure.php.net/manual/en/function.file-get-contents.php
11th Sep 2018, 11:48 PM
🌴Vincent Berger🌴
🌴Vincent Berger🌴 - avatar
0
Hi Vincent Berger, my language is Python, but my question was about Sololearn. When I post a code here in the Playground, is it possible to add a txt file to work with? I need it as input for my code.
12th Sep 2018, 3:30 AM
Marc Maurer
Marc Maurer - avatar