with ruby I can
File.open('yyy.mp4', 'w') { |f| f.write(File.read('xxx.mp4')}
Can I do this using Python ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Sure you can:
Note the binary mode flag there (
b), since you are copying overmp4contents, you don’t want python to reinterpret newlines for you.That’ll take a lot of memory if
xxx.mp4is large. Take a look at theshutil.copyfilefunction for a more memory-efficient option: