Question

In: Computer Science

how do I move a file from downloads to a .py file I'm trying to read...

how do I move a file from downloads to a .py file

I'm trying to read and write on a text file in Python I want to know how to get that file in Python directory

Solutions

Expert Solution

To move any file (it may be a text file or a python file) from one folder to other, follow these steps:

In windows:

1. Right click on the file that you want to move.

2. Click on cut/copy ('cut' removes the selected data from its original position, while the 'copy' creates a duplicate; in both cases the selected data is kept in temporary storage (the clipboard)).

3. Go to the folder where you want to move the file to.

4. Right click on the screen and click on paste.

In Linux:

'mv' command helps user to move file from one location to other.

syntax: mv <source-filepath> <destination-filepath>

example: mv "C:\Users\File_Name.txt" "C:\Users\SubFolder\File_Name.txt"

Note: Extension of the file(.txt, .py) should be mentioned to move the file from one location to another in linux.

Once you get the text file from downloads to the python directory, you can read and write in the text file by mentioning only the name and extention of the file in the python code.

You can also read and write the text file from anywhere by mentioning the path of the text file in the python code.


Related Solutions

How do I do this: Write a program that can read a text file of numbers...
How do I do this: Write a program that can read a text file of numbers and calculate the mean and standard deviation of those numbers. Print the result in another text file. Put the result on the computer screen. EACH LINE OF THE PROGRAM MUST BE COMMENTED!
Please show how the solution was arrived at I'm trying to understand how to do the...
Please show how the solution was arrived at I'm trying to understand how to do the problem. 4.(2) The fern is defined as the unit of force required to accelerate a unit of mass, called the bung, with the gravitational acceleration on the surface of the moon, which is one-sixth the normal gravitational acceleration on earth. a) What is the conversion factor that would be used to convert a force from the natural unit to the derived unit in this...
I'm trying to get motivated in learning the Atiyah-Singer index theorem. In most places I read...
I'm trying to get motivated in learning the Atiyah-Singer index theorem. In most places I read about it, e.g. wikipedia, it is mentioned that the theorem is important in theoretical physics. So my question is, what are some examples of these applications?
I'm trying to use Jupyter (python) to convert the contents of a pkl file into a...
I'm trying to use Jupyter (python) to convert the contents of a pkl file into a dictionary, WITHOUT using pandas. I'm able to import pickle and can open my file...but I'm not sure how to create the dictionary.
Create a geoprocessing tool from the .py file included (script from this file included below). Use...
Create a geoprocessing tool from the .py file included (script from this file included below). Use any csv file you would like. I will work around that. This is for a programming for GIS class. We work with jupyter, idle, arcgis pro import os import arcpy from arcpy import env input_table = r"C:\Answers\January2018.CSV" output_fc = r"C:\Answers\crime.gdb\January2018_Crime" spRef = arcpy.SpatialReference("NAD 1983 StatePlane Missouri East FIPS 2401 (US Feet)") gdb_name = os.path.dirname(output_fc) fc_name = os.path.basename(output_fc) env.overwriteOutput = True print("Creating File GDB") arcpy.CreateFileGDB_management(os.path.dirname(gdb_name),...
I'm working on a to-do list program in Python 2. I'm trying to delete an item...
I'm working on a to-do list program in Python 2. I'm trying to delete an item from the list and I'm not sure what I'm missing to do that. I haven't been able to get it to delete by string or by index number. Also, I'm trying to get the menu to run again after the user completes the add/delete/etc options. Do I need to put menu() menu_option = int(input("Welcome to your To-Do List. Please choose and option to continue:...
I'm having trouble with my do while loop. I'm trying to get it where if the...
I'm having trouble with my do while loop. I'm trying to get it where if the user enter's 3 after whatever amount of caffeinated beverages they've entered before then the loop will close and the rest of my code would proceed to execute and calculate the average price of all the caffeinated beverages entered. Can someone please help me with this? Here's my Code: import java.util.Scanner; public class Main { public static void main(String[] args) { CaffeinatedBeverage[] inventory = new...
I am trying to create a program that reads from a csv file and finds the...
I am trying to create a program that reads from a csv file and finds the sum of total volume in liters of liquor sold from the csv file by county and print that list out by county in descending order. Currently my program runs and gives me the right answers but it is not in descending order. I tried this:     for county, volume in sorted(sums_by_volume.items(), key=lambda x: x[1], reverse=True):         index +=1         print("{}. {} {:.2f}".format(county, sums_by_volume[county]))      When I run...
I have a lab assignment that I'm not sure how to do. The experiment is a...
I have a lab assignment that I'm not sure how to do. The experiment is a cart moving 60cm distance and there is a fan on top of it making it have a mass of .56kg. Every trial there is 100g added to the cart. For this part, the time is kept the same. 1. If the force provided by the fan was the same for each run and we have chosen the same time interval, how does the impulse...
Trying to make sure I'm answering these questions correctly. I'm confused on question d. I can...
Trying to make sure I'm answering these questions correctly. I'm confused on question d. I can explain why in terms of concentration gradient and the fact it's in a hypotonice solution which would cause water to go into the blood vessel, but don't know how to answer it in terms of hydrostatic pressure. 6. Imagine blood in a vessel that has an osmolarity of 300 mEq (a measure of the concentration of particles). Now, imagine that the IF around the...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT