Home > other >  Qpython3
Qpython3

Time:09-28

Why will appear this kind of problem, is the code I write wrong? Written in mobile phone Qpython3

CodePudding user response:

Is there a man, the answer,,,

CodePudding user response:

Weight is integer

CodePudding user response:

reference 1st floor qq_46283664 response:
do you have any man, answer it,,,

% b is binary integer, and cannot be directly connected to the string, you need to use the STR function will he converted to string type value

CodePudding user response:

reference 1st floor qq_46283664 response:
do you have any man, answer it,,,

The sentence is wrong, sorry, confused,
I run, error, the reason is ValueError: unsupported format character 'b' (0 x62) at 8 index
In simple terms, does not support % b this binary placeholder,
Change % d to decimal placeholder % d

CodePudding user response:

in hindsight づ reference 4 floor response:
Quote: refer to 1st floor qq_46283664 response:

Any man, answer it,,,

The sentence is wrong, sorry, confused,
I run, error, the reason is ValueError: unsupported format character 'b' (0 x62) at 8 index
In simple terms, does not support % b this binary placeholder,
Change % d to decimal placeholder % d line

Well well, thank you, careless

CodePudding user response:

s native place references 5 floor response:
Quote: refer to 4th floor in hindsight づ response:
Quote: refer to 1st floor qq_46283664 response:

Any man, answer it,,,

The sentence is wrong, sorry, confused,
I run, error, the reason is ValueError: unsupported format character 'b' (0 x62) at 8 index
In simple terms, does not support % b this binary placeholder,
Change % d to decimal placeholder % d line

Well well, thank you, careless

Don't come to a junction points

CodePudding user response:

Short answer:
For your screenshots of the error, my first feeling, and speculation (verified after, is also the reason is:


And problems caused by not is % b, because of my own after debugging the same code, know if % b, will be another different error:
 ValueError: unsupported format character 'b' (0 x62) at 9 index 

And wouldn't be here:
 SyntaxError: invalid character identifier in 


Solution:
The last Chinese parentheses, instead of the normal English parentheses,
That is:
 weight)) 

Instead of:
 weight)) 


Besides, the problem of % b:
And get rid of the inappropriate writing () should be changed to:
 
# Function:
# presentation error code, should be how to change to the correct code
# Qpython3 - CSDN BBS
# https://bbs.csdn.net/topics/395926666
# Author: Crifan Li
# Update: 20200225


Age=3


# # name=(" Tom ") looks like a tuple tuples, actually not
# print (" type "(name)=% s % type (name)) # type (name)=& lt; The class 'STR' & gt;
# normlTupleValue=https://bbs.csdn.net/topics/(" Tom ", "Tony")
# print (" type "(normlTupleValue)=% s % type (normlTupleValue) # type (normlTupleValue)=& lt; The class 'tuple & gt;
Name="Tom" # according to indicate the STR string


# weight=55
# print (" type "(weight)=% s % type (weight)) # type (weight)=& lt; The class 'int' & gt;
Weight=55.0 # display indicates the float float
# print (" type "(weight)=% s % type (weight)) # type (weight)=& lt; The class 'float' & gt;


# print (" my name is % s, I % b years old this year, my weight is % 2 f kg "% (name, age and weight))
# ValueError: unsupported format character 'b' (0 x62) at 9 index


# % d for formatting the integer to integer


Print (" my name is % s, % d, I, my weight is % 2 kg f "% (name, age and weight))
# I'm Tom, I this year 3 years old, my weight is 55.00 kg



A:
Summarizes a post, just for you reference:
[remind] Python beginner developers matters needing attention: do not intentionally use error writing and should use the standard way right

CodePudding user response:

Wow, good heart, I as a novice can meet people like you, very thank you! Thank you very much!

CodePudding user response:

I really want to, but don't understand to

CodePudding user response:

CodePudding user response:

This is my mobile phone