10. Given a file object "cs" write python statement to print/display
the name of the file.
Answers
Answered by
0
Explanation:
Pʜᴏᴛᴏsʏɴᴛʜᴇsɪs, ᴛʜᴇ ᴘʀᴏᴄᴇss ʙʏ ᴡʜɪᴄʜ ɢʀᴇᴇɴ ᴘʟᴀɴᴛs ᴀɴᴅ ᴄᴇʀᴛᴀɪɴ ᴏᴛʜᴇʀ ᴏʀɢᴀɴɪsᴍs ᴛʀᴀɴsғᴏʀᴍ ʟɪɢʜᴛ ᴇɴᴇʀɢʏ ɪɴᴛᴏ ᴄʜᴇᴍɪᴄᴀʟ ᴇɴᴇʀɢʏ. Dᴜʀɪɴɢ ᴘʜᴏᴛᴏsʏɴᴛʜᴇsɪs ɪɴ ɢʀᴇᴇɴ ᴘʟᴀɴᴛs, ʟɪɢʜᴛ ᴇɴᴇʀɢʏ ɪs ᴄᴀᴘᴛᴜʀᴇᴅ ᴀɴᴅ ᴜsᴇᴅ ᴛᴏ ᴄᴏɴᴠᴇʀᴛ ᴡᴀᴛᴇʀ, ᴄᴀʀʙᴏɴ ᴅɪᴏxɪᴅᴇ, ᴀɴᴅ ᴍɪɴᴇʀᴀʟs ɪɴᴛᴏ ᴏxʏɢᴇɴ ᴀɴᴅ ᴇɴᴇʀɢʏ-ʀɪᴄʜ ᴏʀɢᴀɴɪᴄ ᴄᴏᴍᴘᴏᴜɴᴅs.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
....
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
....
.
.
.
.
.
..
.
.
..
.
..
.
.
.
.
.
.
.
.
.
.
.
....
.
.
...
.
.
.
..
.
..
.
.
Answered by
1
import os
cs = open("some_file")
base = os.path.basename(cs.name)
print(f"name: {os.path.splitext(base)[0]}")
Similar questions