Data Type Conversion Functions Flashcards

(17 cards)

1
Q

int(x,[base])

A

Converts x to an integer. base specifies if x is a string.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

long(x,[base])

A

Converts x to a long integer. base specifies if x is a string

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

float(x)

A

Converts x to a floating-point number

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

complex(real[,imag])

A

Creates a complex number.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

str(x)

A

Converts object x to a string representation.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

repr(x)

A

Converts object x to an expression string.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

eval(str)

A

Evaluates a string and returns an object.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

tuple(s)

A

Converts s to a tuple.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

list(s)

A

Converts s to a list.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

set(s)

A

Converts s to s set.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

dict(d)

A

Creates a dictionary. d must be a sequence of (key,value) tuples.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

frozensets(s)

A

Converts s to a s frozen set.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

chr(x)

A

Converts an integer to a character.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

unichr(x)

A

Converts an integer to a Unicode character.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

ord(x)

A

Converts a single character to its integer value.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

hex(x)

A

Converts an integer to a hexadecimal string.

17
Q

oct(x)

A

Converts an integer to an octal string.