I want do somthing in python equal this code in bash
For example the file.txt in it "dani_web_the_best" and want print "web"
cat file.txt | cut -d"_" -f2
What equal cut -d"_" -f2 in python ?
I dont know if its just me, but that dosent quite make that much sense. Just spend a little more time outlining exactly what you actually want, what your problem is. What you have already tried.
Then we will be much better at helping :)
I dont know if its just me, but that dosent quite make that much sense.
It's not just you.
I think my example its plain
I want code equal cut -d"_" -f2 in python.
Will understand me someone linux system admin
Waiting some one for help
I think 'cut -d"_"' means split on the "_" which would be .split("_") in python but you will have to explain what the rest is. So first you want to post your code that opens the file and reads it one record at a time, and you should be able to split each rec as well after a quick trip to the docs. We can help you from there if we know what you want to do.
Try not to confuse people. Those who knows python does not necessarily know bash. The same way you know bash but do not know python.
BTW, here is your code:
s="dani_web_needs_better_OP" print s.split("_")
One more advice, try to read a book. These things are covered in the introductory chapters.
Thant i was want it :)