如果我编写这段代码:
"Route [team] not defined. (View: /var/www/resources/views/teams.blade.php)"
简单地,输出将是:
import React, { Component } from 'react'
import { View, Text, ImageBackground, Image } from 'react-native'
import { Avatar, Icon, Button, Tile } from 'react-native-elements'
import { Actions } from 'react-native-router-flux'
import styles from './ProfileInListModal.style'
class ProfileInListModal extends Component {
render (user) {
return (
<View style={styles.container}>
<View style={styles.Imagecontainer}>
<Image
style={{height: '100%'}}
source={{uri: this.props.user.data.profile_picture}} />
</View>
<View style={styles.profileContent}>
<Text style={styles.nameTextStyle}>{this.props.user.data.name} {this.props.user.data.age}</Text>
</View>
<View style={styles.locationContainer}>
<Icon name='place' type='place' color='#FFF' size={15} />
<Text style={styles.locationText}> {this.props.user.data.position} </Text>
</View>
<View style={styles.descriptionTextContainer}>
<Text style={styles.descriptionTextStyle}> {this.props.user.data.descriptionText} </Text>
</View>
<View style={styles.socialIconContainer}>
<Icon
name='snapchat-ghost'
type='font-awesome'
color='white'
onPress={() => console.log('hello')}
iconStyle={styles.socialIcons}
/>
<Icon
name='facebook'
type='font-awesome'
color='white'
onPress={() => console.log('hello')}
iconStyle={styles.socialIcons}
/>
<Icon
name='instagram'
type='font-awesome'
color='white'
onPress={() => console.log('hello')}
iconStyle={styles.socialIcons}
/>
</View>
<View style={styles.buttonContainer}>
<Button
icon={<Icon name='message-plus' type='material-community' size={20} color='white' />}
title='Send a message'
titleStyle={{ fontFamily: 'GeosansLight' }}
onPress={this.startchat.bind(this)}
buttonStyle={styles.buttonStyle} />
</View>
</View>
)
}
}
export default ProfileInListModal
但是我想要这样的输出:
const styles = {
container: {
height: '100%',
marginBottom: 38,
},
Imagecontainer: {
height: 370
},
profileContent: {
flexDirection: 'column',
width: '35%',
marginTop: 30
},
nameTextStyle: {
color: 'white',
fontSize: 25,
fontFamily: 'GeosansLight'
},
locationContainer: {
flexDirection: 'row',
marginTop: 10
},
locationText: {
color: 'white',
fontSize: 15,
fontFamily: 'GeosansLight'
},
descriptionTextContainer: {
justifyContent: 'center',
alignItems: 'center',
padding: 30
},
descriptionTextStyle: {
color: 'white',
fontSize: 20,
fontFamily: 'GeosansLight',
textAlign: 'center'
},
socialIconContainer: {
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'center',
padding: 10,
marginBottom: 25
},
socialIcons: {
padding: 8
},
buttonContainer: {
justifyContent: 'center',
alignItems: 'center'
},
buttonStyle: {
backgroundColor: '#D1AF46',
width: 300,
height: 45,
borderColor: 'transparent',
borderWidth: 0,
borderRadius: 5
}
}
export default styles
所以我写了这段代码:
b=list()
b.append(input())
print(b)
但在那里输出是:
["My text"]
如果我使用split(),我观察到正在创建包括list在内的列表。为什么这样?而我该如何解决这个问题呢?
答案 0 :(得分:3)
您可以简单地写
b = input("Enter your text: ").split()
答案 1 :(得分:0)
使用b.extend(...)
。它不会将列表添加为一项,而是列表的所有项。
b.extend(input("Enter your text: ").split())