hi!
I have a string as "C:\local\test\ new"
Let us say str="C:\local\t est\new"
I want to extract the part \test\new and print it on the console as such.
i.e is my desired output is:
\test\local (which is to be printed)
I am facing the following problem:
when i am using the function
print str.split("C:\l ocal")[1]
...
User Profile
Collapse
-
Problems with \t and \b characters
-
WINDOWS - XP
Python 2.5
Editor : IDLE
thanks,
BK -
Can a Python script be invoked like a exe?
Hi,
I have a file say GUI.py which on executing (F5 in IDLE) would display the GUI with some check buttons, text field.
Is there any way that the same script be invoked like a exe file.
Something like double clicking an exe.
If yes, then how do i do that?
Kindly help me in this regard.
thanks,
BK -
-
How to disable a entry field when a button is clicked.
Hi,
I am using Python 2.5.
I have an entry field and a radio button.
I need to disable the entry field when the radio button is selected. How do i change the state to DISABLED in run time.
Kindly help me out.
Thanks,
Bkunjitam -
How to know when a folder is copied in Cygwin using Sendkeys
Using python (Python 2.5) I am invoking a cygwin session by the following code.
The cygwin window is prompted open. Now in the cygwin shell, i issue the following command using "SendKeys"Code:from win32com.client import * a = Dispatch("Wscript.Shell") a.Run("C:/cygwin/cygwin.bat");
...Code:a.SendKeys ("cp -r src_path dest_path"+ -
The problem i am facing is it that during the course of the execution of the script, if knowingly or unknowingly any text editor is opened, the remaining command inside the "a.SendKeys " command is displayed there.
I have no clue why is such a thing happening.
...Code:a.Run("C:/cygwin/cygwin.bat"); #invokes the cygwin session a.SendKeys ("cd D:/temp/code" + "{Enter}")Leave a comment:
-
-
How do i set a limit in an Entry widget
Hi,
I have an Entry widget where in i can enter string.
Clarifications needed:
1. The user should not be able to exceed 15 characters at the max in the Entry widget. How do i set the limit for the same.
2. The user should not be able to enter "SPACE". Is there any such provisions for the same?
Can the same be done in Text widget? -
Hi,
My intention is to have a drop down box (with edit facility) which would have several ip addresses. The user either can select an existing one or else type a new ip.
I could find spinbox option but thats not editable.
So how do i create such a drop down box?
Thanks,
BadriLeave a comment:
-
If that is so, could u please help me in this regard. Are there any pre requisites for the issue?
Thanks,
BK...Leave a comment:
-
How to validate IP address in Python
Hi,
My programme has a text box where in user enters the ip address. I need to validate the IP (like no space allowed in the entry, the numerals should not exceed 255, not more than 3 dots allowed overall, no consecutive dots allowed etc.,.). How do i go about the same? Is there any built in function for the same?
thanks,
Badri -
How to add a drop down box in Python GUI
Hi,
How do i add a drop down box with few pre-populated strings in the same?
I could find list box and drop down menu in the HELP document of Python, but not drop down box.
Please help me in this.
Thanks,
BK -
message getting displayed in another window when invoked
I am invoking a cygwin session by the following code
Scenario: If another window namely NOTEPAD is invoked...Code:from win32com.client import * a = Dispatch("Wscript.Shell") a.Run("C:/cygwin/cygwin.bat"); a.SendKeys ("cd D:/temp/code" + "{Enter}") a.SendKeys ("ls -lrt?" + "{Enter}") -
-
Hi,
As far as my understanding goes, its only when it starts with "Name:" i can use the code snippet provided. But what if i need to search for the string "Name:" and display the values corresponding to it.
e.g if i have a format like mentioned below:
### Name: John
Age: 23
*** Name: Paul
Age: 24
Here how do i go about searching...Leave a comment:
-
Regarding searching of strings
i am a beginner in Python. I have a query.
I have a .txt file which has entries in the following manner:
Name: John
Age: 21
Name: Paul
Age:23
I need to search for the string "Name" and display all the values corresponding to the string that i am searching for. In this case the result should be John and Paul.
I am a bit confused with the re.search() function....
No activity results to display
Show More
Leave a comment: