Author
|
Message
|
RobertoColombo
|
RobertoColombo
Posted 6 Years Ago
|
Group: Forum Members
Last Active: 3 Years Ago
Posts: 1.6K,
Visits: 3.0K
|
Hi, the following code generates an error at the line where isdigit() is used. isdigit() is part of standard Python libs, so I wonder how to get it working. import RLPy
def run_script(): val = 100 if val.isdigit(): print("it is a digit") else: print("it is not a digit") Thanks
Roberto
My PC: OS: Windows 10 Pro English 64-bit / CPU: Intel i7-9700 3.6GHz / MB: ASUS ROG Strix Z390 RAM: 32GB DDR4 2.6GHz / HD: 2TB+3TB / SSD: 2x512GB Samsung 860 EVO + 1x2TB Samsung VB: Palit GTX2080 TI GamingPro 11GB / AB: embedded in the MB and VB (audio from the MOTU M4 I/F) / DirectX: 12
|
|
|
Kelleytoons
|
Kelleytoons
Posted 6 Years Ago
|
Group: Forum Members
Last Active: 2 hours ago
Posts: 9.2K,
Visits: 21.8K
|
Actually, isdigit() refers to a string. This works in iClone Python: str = "1234" print(str.isdigit()) returns true.
Alienware Aurora R16, Win 11, i9-149000KF, 3.20GHz CPU, 64GB RAM, RTX 4090 (24GB), Samsung 870 Pro 8TB, Gen3 MVNe M-2 SSD, 4TBx2, 39" Alienware Widescreen Monitor Mike "ex-genius" Kelley
|
|
|
RobertoColombo
|
RobertoColombo
Posted 6 Years Ago
|
Group: Forum Members
Last Active: 3 Years Ago
Posts: 1.6K,
Visits: 3.0K
|
Hi Mike,
oh... that's right. So, I need to check how to use for a function input parameter (that's the diea: to check whether it is a number)...
Roberto
My PC: OS: Windows 10 Pro English 64-bit / CPU: Intel i7-9700 3.6GHz / MB: ASUS ROG Strix Z390 RAM: 32GB DDR4 2.6GHz / HD: 2TB+3TB / SSD: 2x512GB Samsung 860 EVO + 1x2TB Samsung VB: Palit GTX2080 TI GamingPro 11GB / AB: embedded in the MB and VB (audio from the MOTU M4 I/F) / DirectX: 12
|
|
|
Kelleytoons
|
Kelleytoons
Posted 6 Years Ago
|
Group: Forum Members
Last Active: 2 hours ago
Posts: 9.2K,
Visits: 21.8K
|
Well, it has to be *something* to begin with -- either it's a number, or it's a string that may or may not contain numbers. If it's a string and you're not sure if it's all digits, you can use that function (so "A103" would return false). And if you're not sure what type it is, use the function type().
Alienware Aurora R16, Win 11, i9-149000KF, 3.20GHz CPU, 64GB RAM, RTX 4090 (24GB), Samsung 870 Pro 8TB, Gen3 MVNe M-2 SSD, 4TBx2, 39" Alienware Widescreen Monitor Mike "ex-genius" Kelley
Edited
6 Years Ago by
Kelleytoons
|
|
|
RobertoColombo
|
RobertoColombo
Posted 6 Years Ago
|
Group: Forum Members
Last Active: 3 Years Ago
Posts: 1.6K,
Visits: 3.0K
|
Ok, my point is to check function parameters for type consistency. I am an old C programmer and I learnt to use strict conventions... that's why Python for me is just too loose...
My PC: OS: Windows 10 Pro English 64-bit / CPU: Intel i7-9700 3.6GHz / MB: ASUS ROG Strix Z390 RAM: 32GB DDR4 2.6GHz / HD: 2TB+3TB / SSD: 2x512GB Samsung 860 EVO + 1x2TB Samsung VB: Palit GTX2080 TI GamingPro 11GB / AB: embedded in the MB and VB (audio from the MOTU M4 I/F) / DirectX: 12
|
|
|
Kelleytoons
|
Kelleytoons
Posted 6 Years Ago
|
Group: Forum Members
Last Active: 2 hours ago
Posts: 9.2K,
Visits: 21.8K
|
Yeah, Python won't do that. Here's some explanation of this process: https://stackoverflow.com/questions/402504/how-to-determine-a-python-variables-type
Alienware Aurora R16, Win 11, i9-149000KF, 3.20GHz CPU, 64GB RAM, RTX 4090 (24GB), Samsung 870 Pro 8TB, Gen3 MVNe M-2 SSD, 4TBx2, 39" Alienware Widescreen Monitor Mike "ex-genius" Kelley
|
|
|
justaviking
|
justaviking
Posted 6 Years Ago
|
Group: Forum Members
Last Active: 3 Weeks Ago
Posts: 8.2K,
Visits: 26.5K
|
@Roberto and Mike,
It's fun and fascination watching the two of you work together. I'm sorry you need to do all this reverse engineering and forensic discovery to figure out how it should work, and never knowing for sure if it's a bug, a documentation error, or user error.
On behalf of all the people who will benefit from your pioneering efforts, "Thank you!"
iClone 7... Character Creator... Substance Designer/Painter... Blender... Audacity... Desktop (homebuilt) - Windows 10, Ryzen 9 3900x CPU, GTX 1080 GPU (8GB), 32GB RAM, Asus X570 Pro motherboard, 2TB SSD, terabytes of disk space, dual monitors. Laptop - Windows 10, MSI GS63VR STEALTH-252, 16GB RAM, GTX 1060 (6GB), 256GB SSD and 1TB HDD
|
|
|
RobertoColombo
|
RobertoColombo
Posted 6 Years Ago
|
Group: Forum Members
Last Active: 3 Years Ago
Posts: 1.6K,
Visits: 3.0K
|
Yeah... Mike has promised to invite me in Florida if I can help him... right Mike ?
My PC: OS: Windows 10 Pro English 64-bit / CPU: Intel i7-9700 3.6GHz / MB: ASUS ROG Strix Z390 RAM: 32GB DDR4 2.6GHz / HD: 2TB+3TB / SSD: 2x512GB Samsung 860 EVO + 1x2TB Samsung VB: Palit GTX2080 TI GamingPro 11GB / AB: embedded in the MB and VB (audio from the MOTU M4 I/F) / DirectX: 12
Edited
6 Years Ago by
RobertoColombo
|
|
|
Kelleytoons
|
Kelleytoons
Posted 6 Years Ago
|
Group: Forum Members
Last Active: 2 hours ago
Posts: 9.2K,
Visits: 21.8K
|
You and Dennis are always welcome here (we don't have a ton of guest room, but I'm sure we can work something out).
Alienware Aurora R16, Win 11, i9-149000KF, 3.20GHz CPU, 64GB RAM, RTX 4090 (24GB), Samsung 870 Pro 8TB, Gen3 MVNe M-2 SSD, 4TBx2, 39" Alienware Widescreen Monitor Mike "ex-genius" Kelley
|
|
|
RobertoColombo
|
RobertoColombo
Posted 6 Years Ago
|
Group: Forum Members
Last Active: 3 Years Ago
Posts: 1.6K,
Visits: 3.0K
|
Could be more than just an idea...
My PC: OS: Windows 10 Pro English 64-bit / CPU: Intel i7-9700 3.6GHz / MB: ASUS ROG Strix Z390 RAM: 32GB DDR4 2.6GHz / HD: 2TB+3TB / SSD: 2x512GB Samsung 860 EVO + 1x2TB Samsung VB: Palit GTX2080 TI GamingPro 11GB / AB: embedded in the MB and VB (audio from the MOTU M4 I/F) / DirectX: 12
|
|
|