Hello! I am trying to write a program in Pynthon. Need help. Requirements: Write a .py file like KevFiles.py (I used Spyder to do this).In that .py, create a function that strips the first letters from all file names in a directory. If the new name is a duplicate of an existing name, Python will throw an exception. Handle that exception by adding “dup” a number as part of the files new name.Call that function from a Jupyter Notebook, passing in the number of characters to delete and the file path.   Thank you!

Question

Hello!

I am trying to write a program in Pynthon.

Need help.

Requirements:

Write a .py file like KevFiles.py (I used Spyder to do this).
In that .py, create a function that strips the first letters from all file names in a directory. If the new name is a duplicate of an existing name, Python will throw an exception. Handle that exception by adding “dup” a number as part of the files new name.
Call that function from a Jupyter Notebook, passing in the number of characters to delete and the file path.

 

Thank you!

Expert Answer

Want to see the step-by-step answer?

See Answer

Check out a sample Q&A here.

Want to see this answer and more?

Experts are waiting 24/7 to provide step-by-step solutions in as fast as 30 minutes!*

See Answer
*Response times vary by subject and question complexity. Median response time is 34 minutes and may be longer for new subjects.

Related Computer Science Q&A

Find answers to questions asked by student like you
Show more Q&A

Q: If you are reading a flat file, with minimal information regarding business rules and constraints. H...

A: Solution:Even though the file contains minimal information about business rules and constraints, the...

Q: The symmetric difference of two sets S1 and S2 is defined as S1 ⊝ S2 = {x : x ∈ S1 or x ∈ S2, but x ...

A: Solution:Given that,The symmetric difference between two sets such as “S1” and “S2” can be expressed...

Q: What are the internal components of a computer that make it function?

A: A computer system consists of multiple hardware devices which, with the help of software, perform co...

Q: Do you think technologies like Big Data and Predictive Analytics in Marketing would have worked 10-1...

A: The technologies like Big Data would not have worked 10-15 years back as due to lack of large datase...

Q: how is macro work in word 2016

A: At first we need to enable the developer Tab if it's not enabled previously.Next, we need to click t...

Q: When disposing disks or hard drives, it is recommended to format them (writing binary zeros) at leas...

A: Reason of formatting the disks or hard drives is as follows:

Q: Consider the following procedure: procedure mystery (x, y, z); integer x, y, z;beginz = 2; y= z+x;en...

A: Pass by reference copies the location of argument to the parameter. Hence, the final value of n, A[1...

Q: How would I write a C program to find the length of the longest substring of a given string without ...

A: The given program is to find the maximum length of the substring without repeating character. This i...

Q: Typically, a hospital patient receives medication that have been ordered by a particular doctor. Bec...

A: Lets write the business logic first. The business rules between PATIENT and ORDER will be.• A patien...