first openAI result

huang 0 like s 393 view s

Tags:

https://chat.openai.com/chat

write a script, output the first token of every line of a file

```

Open the file

with open("file.txt", "r") as file: # Loop through each line in the file for line in file: # Strip the line to remove any leading or trailing whitespace line = line.strip() # Split the line into tokens (words) tokens = line.split() # Print the first token (word) print(tokens[0]) ```

like unlike

点赞本文的读者

还没有人对此文章表态


本文有评论

没有评论

看文章,发评论,不要沉默


© 2023 XGenes.com Impressum