(→PHP) |
(→PHP) |
||
| 4번째 줄: | 4번째 줄: | ||
==PHP== | ==PHP== | ||
[[분류: PHP]] | [[분류: PHP]] | ||
{{다른뜻|PHP print_r()}} | |||
{{다른뜻|PHP var_export()}} | |||
<source lang='php'> | <source lang='php'> | ||
$arr = [10,"test",10.5]; | $arr = [10,"test",10.5]; | ||
2017년 10월 19일 (목) 13:50 판
- list to string
- array to string
1 PHP
- 다른 뜻에 대해서는 PHP print_r() 문서를 참조하십시오.
- 다른 뜻에 대해서는 PHP var_export() 문서를 참조하십시오.
PHP
Copy
$arr = [10,"test",10.5];
$str = print_r( $arr, true );
echo gettype($str) . PHP_EOL;
print_r( $str );
# string
# Array
# (
# [0] => 10
# [1] => test
# [2] => 10.5
# )
PHP
Copy
$arr = [10,"test",10.5];
$str = var_export( $arr, true );
echo gettype($str) . PHP_EOL;
print_r( $str );
# string
# array (
# 0 => 10,
# 1 => 'test',
# 2 => 10.5,
# )
2 Python
- Python 2
Python
Copy
mylist = [10,"test",10.5]
print( type(mylist) )
print( mylist )
# <type 'list'>
# [10, 'test', 10.5]
mystr = str(mylist)
print( type(mystr) )
print( mystr )
# <type 'str'>
# [10, 'test', 10.5]
편집자 Jmnote Jmnote bot
로그인하시면 댓글을 쓸 수 있습니다.
- 분류 댓글:
- Python (25)
- PHP (8)
리눅스 Python 2.7 컴파일 설치 ― …리눅스 Python 2.7 컴파일 설치 ― …리눅스 Python 2.7 컴파일 설치 ― …리눅스 Python 2.7 컴파일 설치 ― …리눅스 Python 2.7 컴파일 설치 ― Jmnote리눅스 Python 2.7 컴파일 설치 ― ㅇㅇㅇ미운코딩새끼 ― 승호 도령미운코딩새끼 ― 불탄고등어미운코딩새끼 ― 김레이미운코딩새끼 ― 호박이미운코딩새끼 ― Junhg0211미운코딩새끼 ― 김왼손미운코딩새끼 ― 용딘이미운코딩새끼 ―Pinkcrimson
유기농냠냠파이썬 ― 호박유기농냠냠파이썬 ― 이에스유기농냠냠파이썬 ― 이승현파이썬 global ― Jmnote파이썬 global ― John Jeong파이썬 global ― Jmnote파이썬 global ― John Jeong파이썬 global ― John Jeong파이썬 global ― John Jeong파이썬 global ― Jmnote파이썬 global ― John Jeong