Question
Hi, So, I'm trying to slice the username, root from each line that comes from a text file, but I had no success on getting
Hi,
So, I'm trying to slice the username, "root" from each line that comes from a text file, but I had no success on getting my program assignment to do so. First, I need to find and get the offset of "invalid user" from the start of the line. Then, I have to check the starting point of username, "root" by adding the length of "invalid user" to the offset given via "find()" method, which should be the index of the first character of "root". Then, I have to use the same method as above for the word, "from", which are on those same lines. At this point, I have to slice the user name from the line using the starting and ending points and store the result in a variable. The end result should be able to display the sliced username, "root", which is the problem that I'm having. Can you help me try to resolve this matter? I attached the text file and my program to look at. Thank you.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started