有一个包含以下内容的jsx文件
<import name="abcd" color="green" age="25" />
<View color={dsdssd}>
<IBG
color={[color.imagecolor, color.image125]}
imageStyle={[styles.imageStyle, styles.image125]}
source={{ uri: contents.aimeecard }} >
<View color={styles.titleContainer}>
<Text color={[{green: 45}, styles.mainTileText]}</Text>
<View color={[abcde.text]} />
</View>
</View>
我需要使用Python脚本获取第一行的详细信息: 期望输出 name="abcd" color="green" age="25"
同时,通过列表传递jsx文件的路径 例如:[abcd/file1.jsx,dcef/file2.jsx]
尝试使用Python代码通过列表获取jsx文件
for file in jsx_path:
data = md.parse("file")
print( file.firstChild.tagName )
数值未被获取并且出现错误。
有人能帮助我解决这个问题吗?
print( data.firstChild.tagName )
,因为你正在将已解析的数据存储在变量data
中,而不是变量file
。 - Tyler Stoney