positional argument follows keyword argument

学Python制作词云过程中出现“positional argument follows keyword argument”报错,之前在在线编辑器中看了看说是问题在第12行。

img

from random import *
counts={}
with open("new.csv",'r',encoding='utf-8') as a:
    for t in a :
        t=t.strip()
        code,name=t.split(",")
        counts[name]=randint(30,100)
import matplotlib.pyplot as plt
from wordcloud import WordCloud
from imageio.v2 import imread
pic=imread('love.png')
wc=WordCloud(mask=pic, font_path== 'Songti.ttc',
               repeat=False,
               background_color='white',
               max_words=100,
               max_font_size=120,
               min_font_size=10,
               random_state=50,
               scale=1 )
wc.generate_from_frequencies(counts)
plt.imshow(wc)
plt.show()

wc=WordCloud(mask=pic, font_path== 'Songti.ttc',
目测=你写成了==

不知道你这个问题是否已经解决, 如果还没有解决的话:
  • 这篇博客: python函数的位置参数(Positional)和关键字参数(keyword)中的 3.2 argument 部分也许能够解决你的问题, 你可以仔细阅读以下内容或者直接跳转源博客中阅读:

            A value passed to a function (or method) when calling the function. There are two kinds of argument:

            keyword argument: an argument preceded by an identifier (e.g. name=) in a function call or passed as a value in a dictionary preceded by **. For example, 3 and 5 are both keyword arguments in the following calls to complex():
    complex(real=3, imag=5)
    complex(**{'real': 3, 'imag': 5})

            positional argument: an argument that is not a keyword argument. Positional arguments can appear at the beginning of an argument list and/or be passed as elements of an iterable preceded by *. For example, 3 and 5 are both positional arguments in the following calls:
    complex(3, 5)
    complex(*(3, 5))

             Arguments are assigned to the named local variables in a function body. See the Calls section for the rules governing this assignment. Syntactically, any expression can be used to represent an argument; the evaluated value is assigned to the local variable.
              See also the parameter glossary entry, the FAQ question on the difference between arguments and parameters, and PEP 362.


如果你已经解决了该问题, 非常希望你能够分享一下解决方案, 写成博客, 将相关链接放在评论区, 以帮助更多的人 ^-^